import request from "@/utils/request";
import { AxiosPromise } from "axios";
import {
  RequestParams,
  LibraryPageVo,
  ResponseData,
  Params,
  bookReturn,
} from "./types";

/**
 * 列表数据
 * @param data {LoginData}
 * @returns
 */
export function getLibraryList(
  data: RequestParams
): AxiosPromise<ResponseData<LibraryPageVo>> {
  return request({
    url: "/api/v1/returnTask/page",
    method: "post",
    data,
    headers: {
      //需要加密的请求在头部塞入标识
      isEncrypt: 1,
    },
  });
}
// export const loginApi =(params:LoginData)=>{
//   return request.post<LoginResult>('/api/v1/auth/login',params)
// }
/**
 * 下拉列表数据
 */

export function libraryaOptions(
  data: Params
): AxiosPromise<ResponseData<bookReturn>> {
  return request({
    url: `/api/v1/returnTaskDetail/tempPage`,
    method: "post",
    data,
    headers: {
      //需要加密的请求在头部塞入标识
      isEncrypt: 1,
    },
  });
}
// export const inventoryRouteOptions = (aesKeyByRsa: string) => {
//   return request<ResponseData<any>>({
//     url: "/api/v1/inventoryRoute/options",
//     method: "post",
//     data: aesKeyByRsa,
//     headers: {
//       //需要加密的请求在头部塞入标识
//       isEncrypt: 1,
//     },
//   });
// };
// export const inventoryTask = (aesKeyByRsa: string) => {
//   return request<ResponseData<any>>({
//     url: "/api/v1/inventoryTask/startTask",
//     method: "post",
//     data: aesKeyByRsa,
//     headers: {
//       //需要加密的请求在头部塞入标识
//       isEncrypt: 1,
//     },
//   });
// };
// export const LibraryOptions = (aesKeyByRsa: string) => {
//   return request<ResponseData<any>>({
//     url: "/api/v1/library/options",
//     method: "post",
//     data: aesKeyByRsa,
//     headers: {
//       //需要加密的请求在头部塞入标识
//       isEncrypt: 1,
//     },
//   });
// };
export const controlTaskChange = (controlType: any, taskId: any) => {
  return request<ResponseData<any>>({
    url: "/api/v1/returnTask/controlTask",
    method: "post",
    data: {
      controlType,
      taskId,
    },
    headers: {
      //需要加密的请求在头部塞入标识
      isEncrypt: 1,
    },
  });
};
